package com.lf.web.service;

import org.json.JSONObject;

public class ResponseInfo extends JSONObject {

    public static final String CODE = "code";

    public ResponseInfo() {
        super();
    }

    public ResponseInfo(boolean result) {
        super();
        setCode(result);
    }

    public ResponseInfo(int code) {
        super();
        setCode(code);
    }

    public void setCode(int code) {
        this.put(this.CODE, code);
    }

    public void setCode(boolean result) {
        if (result) {
            this.setCode(ResponseCode.SUCCESS);
        } else {
            this.setCode(ResponseCode.FAILURE);
        }
    }

    public int getCode() {
        return this.getInt(CODE);
    }

}
